home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / Documents+.as < prev    next >
Encoding:
Text File  |  1998-02-16  |  1.5 KB  |  46 lines  |  [TEXT/ToyS]

  1. property dNames : ["Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…", "Add…"]
  2. property dDocs : [null, null, null, null, null, null, null, null, null, null, null, null]
  3. property dBounds : [40, 40, 445, 108]
  4.  
  5. on run
  6.     dd install with fonts {name:"Helvetica", size:9} float above every application
  7.     --if dBounds = null then set dBounds to dd calc dialog bounds [405, 68]
  8.     dd make dialog {bounds:dBounds, default item:0, contents:[¬
  9.         b(1), b(2), b(3), b(4), b(5), b(6), ¬
  10.         b(7), b(8), b(9), b(10), b(11), b(12) ¬
  11.         ], style:sideways palette, name:"Documents", closeable:true}
  12.     repeat
  13.         try
  14.             if DoAction(dd interact with user) then exit repeat
  15.         on error number err
  16.             dd set bounds of dialog 1 to dBounds
  17.             if err ≠ -128 then exit repeat
  18.         end try
  19.     end repeat
  20.     set dBounds to dd get bounds of dialog 1
  21.     dd uninstall
  22. end run
  23.  
  24. on b(i)
  25.     set x to 5 + ((i - 1) mod 4) * 100
  26.     set y to 5 + ((i - 1) div 4) * 21
  27.     return {class:push button, bounds:[x, y, x + 95, y + 16], name:item i of dNames}
  28. end b
  29.  
  30. on DoAction(i)
  31.     if i = -1 then return true
  32.     if item i of dDocs = null then
  33.         activate
  34.         set dBounds to dd get bounds of dialog 1
  35.         dd set bounds of dialog 1 to [0, -900, 405, -872]
  36.         set doc to choose file with prompt "Select a document:"
  37.         dd set bounds of dialog 1 to dBounds
  38.         set n to (info for doc)'s name
  39.         dd set name of item i of dialog 1 to n
  40.         set item i of dNames to n
  41.         set item i of dDocs to doc
  42.     else
  43.         tell application "Finder" to open item i of dDocs
  44.     end if
  45.     return false
  46. end DoAction